OPEN "c:\romhack\opcodes.txt" FOR INPUT AS #1
OPEN "c:\romhack\opcodes2.txt" FOR OUTPUT AS #2


PRINT #2, "LONG __fastcall TmyForm::GetTextPointers( LONG lpCurPosi )"
PRINT #2, "{"
PRINT #2, "  LONG lpOffset = lpCurPosi;"
PRINT #2, "  WORD index    = 0;"
PRINT #2,
PRINT #2, "  while( index != 0xFFFF )"
PRINT #2, "  {"
PRINT #2, "    index = WGET( rom.data, lpOffset )"
PRINT #2, "    //"
PRINT #2, "    switch( index )"
PRINT #2, "    {";
PRINT #2,
'//------------
index% = 1
CLS

DO
  LINE INPUT #1, tex$
  IF MID$(tex$, 1, 1) = "$" THEN
    hexval$ = MID$(tex$, 2, 4)
    text$ = MID$(tex$, 9, 1)
    '//------------------
    IF VAL(text$) > 0 AND VAL(text$) < 9 THEN
      PRINT #2, "      case 0x"; hexval$; " : lpOffset +="; STR$(VAL(text$) * 2); "; break;     // "; MID$(tex$, 9, LEN(tex$))
    ELSE
      PRINT #2, "      case 0x"; hexval$; " : break;     // "; MID$(tex$, 9, LEN(tex$))
    END IF

  END IF
LOOP UNTIL EOF(1)

PRINT #2, "      default     : lpOffset += 2; break;"
PRINT #2, "    }"
PRINT #2, "  }"
PRINT #2,
PRINT #2, "  return lpOffset;"
PRINT #2, "}"


CLOSE

